<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <script src="{{mix('/js/web/image/uploadPreview.min.js')}}"></script>
    <script src="{{mix('/js/web/user/prove.js')}}"></script>
    <link rel="stylesheet" href="{{asset('/css/plugins/jQueryUI/jquery-ui-1.11.4.min.css')}}">
    <link rel="stylesheet" href="{{mix('/css/web/inc/ui-autocomplete.css')}}">
    <link rel="stylesheet" href="{{mix('/css/web/user/prove.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.member_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">企业认证</div>
                <div class="steps_list">
                    <div class="steps">
                        @if(empty($info) || array_get($info, 'step') == 0)
                            <span class="xuanz">1.提交基础资料</span>
                            <span class="xuanzno">2.验证打款金额</span>
                            <span class="xuanzno">3.用户认证成功</span>
                        @elseif(!empty($info) && (array_get($info, 'step') == 1 or array_get($info, 'step') == 2 or array_get($info, 'step') == 3))
                            <span class="xuanz">1.提交基础资料</span>
                            <span class="xuanz">2.验证打款金额</span>
                            <span class="xuanzno">3.用户认证成功</span>
                        @elseif(!empty($info) && array_get($info, 'step') == 4)
                            <span class="xuanz">1.提交基础资料</span>
                            <span class="xuanz">2.验证打款金额</span>
                            <span class="xuanz">3.用户认证成功</span>
                        @endif

                    </div>
                </div>
                <div class="tab_content">
                    <div class="center_width center_width2 step_one" style="display: @if(empty($info) || array_get($info, 'step') == 0) block @else none @endif">
                        <div class="table">
                            <form action="{{asset('member/user/company/saveinfo')}}"  id="company_info" method="post" enctype="multipart/form-data" onsubmit="javascript:return false;">
                                <table>
                                    <tr>
                                        <td class="type_title">公司名称</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_company" value="{{!empty($info)?array_get($info, 'company_name'):""}}" autocomplete="off" placeholder="请填写营业执照上的名称">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">公司法人</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_companyname" value="{{!empty($info)?array_get($info, 'angent'):""}}" autocomplete="off" placeholder="请填写营业执照上的法定代表人">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">组织机构代码</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="organization_code" value="{{!empty($info)?array_get($info, 'organization_code'):""}}" autocomplete="off" placeholder="请填写营业执照上的组织机构代码">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                   {{-- <tr>
                                        <td class="type_title">注册所在地</td>
                                        <td class="type_con">
                                            <input type="hidden" class="jm_input1" name="rz_zhuceaddress" value="{{array_get($info, 'reg_location')}}" autocomplete="off" placeholder="请填写营业执照上的住所">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>--}}
                                    <input type="hidden" class="jm_input1" name="rz_zhuceaddress" value="1" autocomplete="off">
                                    <tr>
                                        <td class="type_title">公司地址</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_companyaddress" value="{{!empty($info)?array_get($info, 'company_address'):""}}" autocomplete="off" placeholder="请填写营业执照上的住所">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">公司电话</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_companyphone" value="{{!empty($info)?array_get($info, 'company_tel'):""}}"  autocomplete="off" placeholder="请填写开票资料的电话" onkeyup="this.value=this.value.replace(/\D/g,'')">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">开户银行</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_kaihuyinhang" value="{{!empty($info)?array_get($info, 'bank'):""}}" autocomplete="off" placeholder="请填写对公银行开户银行">
                                           <!--  <ul class="auto-dropdown">
                                            </ul> -->
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">银行账号</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="rz_yinhangzhanghao" value="{{!empty($info)?array_get($info, 'bank_account'):""}}" onkeyup="this.value=this.value.replace(/\D/g,'')" autocomplete="off" placeholder="请填写对公银行账号">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title">社会信用证号</td>
                                        <td class="type_con">
                                            <input type="text" class="jm_input1" name="social_unify_number" value="{{!empty($info)?array_get($info, 'social_unify_number'):""}}"  autocomplete="off" placeholder="请输入15位营业执照注册号或是18位统一社会信用代码">
                                            <p class="jm_error fl"></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="type_title" valign="top" style="padding-top: 16px;">证件上传</td>
                                        <td>
                                            <ul class="document_type">
                                                <li @if(!empty($info) && array_get($info, 'licence_type') == 'multi' or empty(array_get($info, 'licence_type'))) class="active" @endif data-type="multi">普通营业执照</li>
                                                <li @if(!empty($info) && array_get($info, 'licence_type') == 'single') class="active" @endif data-type="single">多证合一营业执照</li>
                                            </ul>
                                            <div class="uploadbigbox">
                                                <ul class="uploadbox" style="display: @if(!empty($info) && array_get($info, 'licence_type') == 'multi' or empty(array_get($info, 'licence_type'))) block @else none @endif">
                                                    <li>
                                                        <div class="iconbox" id="business_license_div" data-type="1">
                                                            <img src="<?php if(!empty($info) && array_get($info, 'agnet_licence') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'agnet_licence');}else{echo asset('/img/web/inc/icon/btn1.png');}?>" alt="" id="business_license_img" />
                                                        </div>
                                                        <div class="word">法人营业执照</div>
                                                        <input type="file" class="upload" id="business_license_file" name="business_license_file" />
                                                        <input type="hidden" class="upload" id="business_license" name="business_license" value="<?php if(!empty($info) && array_get($info, 'agnet_licence') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'agnet_licence');}?>"/>

                                                    </li>
                                                    <li>
                                                        <div class="iconbox" id="tax_certificate_div">
                                                            <img src="<?php if(!empty($info) && array_get($info, 'tax_certificate') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'tax_certificate');}else{echo asset('/img/web/inc/icon/btn2.png');}?>" alt="" id="tax_certificate_img" />
                                                        </div>
                                                        <div class="word">公司税务登记证</div>
                                                        <input type="file" class="upload" id="tax_certificate_file" name="tax_certificate_file" />
                                                        <input type="hidden" class="upload" id="tax_certificate" name="tax_certificate" value="<?php if(!empty($info) && array_get($info, 'tax_certificate') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'tax_certificate');}?>"/>
                                                    </li>
                                                    <li>
                                                        <div class="iconbox" id="code_certificate_div">
                                                            <img src="<?php if(!empty($info) && array_get($info, 'organization_code_certificate') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'organization_code_certificate');}else{echo asset('/img/web/inc/icon/btn3.png');}?>" alt="" id="code_certificate_img" />
                                                        </div>
                                                        <div class="word">组织机构代码证</div>
                                                        <input type="file" class="upload" id="code_certificate_file" name="code_certificate_file" />
                                                        <input type="hidden" class="upload" id="code_certificate" name="code_certificate" value="<?php if(!empty($info) && array_get($info, 'organization_code_certificate') and array_get($info, 'licence_type') =='multi'){echo array_get($info, 'organization_code_certificate');}?>"/>
                                                    </li>
                                                </ul>
                                                <ul class="uploadbox uploadbox2" style="display:@if(!empty($info) && array_get($info, 'licence_type') == 'single') block @else none @endif">
                                                    <li>
                                                        <div class="iconbox" id="multi_license_div">
                                                            <img src="<?php if(!empty($info) && array_get($info, 'agnet_licence') and array_get($info, 'licence_type') =='single'){echo array_get($info, 'agnet_licence');}else{echo asset('/img/web/inc/icon/btn1.png');}?>" alt="" id="multi_license_img" />
                                                        </div>
                                                        <div class="word">多证合一营业执照</div>
                                                        <input type="file" class="upload" id="multi_license_file" name="multi_license_file" />
                                                        <input type="hidden" class="upload" id="multi_license" name="multi_license" value="<?php if(!empty($info) && array_get($info, 'agnet_licence') and array_get($info, 'licence_type') =='single'){echo array_get($info, 'agnet_licence');}?>"/>
                                                    </li>
                                                </ul>
                                            </div>
                                            <div class="uploadbigbox_ts">以上证件图片仅支持格式为.PNG .JPG .GIF，大小在5M以内的单张图片上传!</div>
                                            <p class="jm_error fl" style="position: relative;"></p>
                                        </td>
                                    </tr>
                                </table>

                                <div class="save-box">
                                    {{csrf_field()}}
                                    <input type="hidden" value="{{!empty($info) && array_get($info, 'id')}}" id="company_id" name="company_id" />
                                    <input type="hidden" value="<?php if(!empty($info) && array_get($info, 'licence_type')){echo array_get($info, 'licence_type');}else{echo 'multi';}?>" id="licence_type" name="licence_type" />
                                    <input type='submit' value='提交申请' class="submit1" data-step="1"/>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
                <div class="tab_content step_two" style="display:@if(!empty($info) && (array_get($info, 'step') == 1 or array_get($info, 'step') == 2 or array_get($info, 'step') == 3)) block @else none @endif">
                    <div class="center_width" style="display:block">
                        <div class="basicsbox" style="display:@if(!empty($info) && array_get($info, 'step') == 3) block @else none @endif">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/fail_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">您提交的信息未通过，请重新提交！</p>
                                <p class="word2">{{!empty($info)?array_get($info, 'fail_reason'):""}}<a class="btn_error"  target="_blank"><span>重新填写</span></a></p>
                            </div>
                        </div>
                        <div class="basicsbox" style="display:@if(!empty($info) && array_get($info, 'step') == 1) block @else none @endif">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/success_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">提交信息成功！</p>
                                <p class="word2">e井在线将在工作日的两小时内给您企业账户转入一笔认证资金，收款后填写您的收款金额并提交验证，验证通过则会员认证成功。</p>
                            </div>
                        </div>
                        <div class="basicsbox" style="display:@if(!empty($info) && array_get($info, 'step') == 2) block @else none @endif">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/success_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">打款成功！</p>
                                <p class="word2">e井在线将在工作日的两小时内给您企业账户转入一笔认证资金，收款后填写您的收款金额并提交验证，验证通过则会员认证成功。</p>
                            </div>
                        </div>

                        <form style="display:@if(!empty($info) && array_get($info, 'step') == 3) none @else block @endif" action="{{asset('member/user/company/prove_save_step')}}" method="post" id="frm_prove_step">
                            <div class="playmoney">
                                <div class="inputbox">
                                    <div class="left">开户银行</div>
                                    <div class="right">{{!empty($info)?array_get($info, 'bank'):""}}</div>
                                </div>
                                <div class="inputbox">
                                    <div class="left">银行帐号</div>
                                    <div class="right">{{!empty($info)?array_get($info, 'bank_account'):""}}</div>
                                </div>
                                <div class="inputbox">
                                    <div class="left">收到金额</div>
                                    <div class="right">
                                        <input type="text" name="money" value="" class="money">元
                                        <p class="jm_error" style="position:relative"></p>
                                    </div>
                                </div>
                                <div class="save-box">
                                    {{csrf_field()}}
                                    <input type="hidden" value="" id="company_id" name="company_id" />
                                    <input type='submit' value='提交申请' class="submit2"  data-step="2">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="tab_content" style="display:@if(!empty($info) && array_get($info, 'step') == 4) block @else none @endif">
                    <div class="center_width" style="display:block">
                   {{--     <div class="basicsbox" style="display: @if(2==2){{'block'}}@else{{'none'}}@endif">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/true_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">信息提交成功，正在审核！</p>
                                <p class="word2">我们将在2个工作日内完成审核，请您耐心等待，如有任何疑问请联系客服！</p>
                            </div>
                        </div>
                        <div class="basicsbox" style="display: @if(3==3){{'block'}}@else{{'none'}}@endif">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/fail_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">审核失败，请修改相关信息。</p>
                                <p class="word2">失败原因：1111</p>
                            </div>
                        </div>--}}
                        <div class="basicsbox" style="display: block">
                            <div class="fl imgbox">
                                <img src="{{asset('/img/web/inc/icon/success_big.png')}}" alt="">
                            </div>
                            <div class="fl wordbox">
                                <p class="word1">恭喜您，已通过企业认证！</p>
                                <p class="word2">还差一步就可以开设企业商铺，马上<a href="{{asset('/member/user/companymaterial')}}" target="_blank"><span>完善资料</span></a>！如果已完善资料请直接提交开设商铺申请。查看</span></a>您的专属特权吧！</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
</body>
</html>
<script src="{{mix('/js/banklist.js')}}"></script>
<script src="{{asset('/js/plugins/jquery-ui/jquery-ui-1.11.4.min.js')}}"></script>
<script src="{{asset('/js/plugins/jquery-ui/jquery-migrate-3.0.0.min.js')}}"></script>
<script src="{{mix('/js/web/inc/fileUpload.js')}}"></script>
<script>
    // 图片上传

    function uploadajax(_this,type) {
        var url = AJAX_URL + '/uploads/images';
        var files =  _this.files[0];
        var formFile = new FormData();
        formFile.append("image", files);
        // var index=layer.load(2,{shade:[0.1,'#000']})//0.1透明度的黑色背景
        // $.ajax({
        //     url: url,
        //     type: "POST",
        //     data: formFile,
        //     contentType: false,
        //     cache: false,
        //     processData: false,
        //     // 显示加载图片
        //     success: function (res) {
        //         layer.close(index)
        //         if (res.status == 0){
        //             if(type == 1){
        //                 $("#business_license_img").attr('src',res.path);
        //                 $('input[name="business_license"]').val(res.path);
        //             }else if(type ==2){
        //                 $("#tax_certificate_img").attr('src',res.path);
        //                 $('input[name="tax_certificate"]').val(res.path);
        //             }else if(type ==3){
        //                 $("#code_certificate_img").attr('src',res.path);
        //                 $('input[name="code_certificate"]').val(res.path);
        //             }else if(type ==4){
        //                 $("#multi_license_img").attr('src',res.path);
        //                 $('input[name="multi_license"]').val(res.path);
        //             }
        //             layer.alert('图片上传成功！', {
        //                 title:'提示',
        //                 icon: 1
        //             });
        //         }
        //         else{
        //             layer.alert('图片上传失败', {
        //                 title:'提示',
        //                 icon: 2
        //             });
        //         }
        //     },
        //     error: function () {
        //         layer.close(index)
        //         layer.alert('图片上传失败', {
        //                 title:'提示',
        //                 icon: 2
        //             });
        //     }
        // });
        var cb=function(res){
            if(type == 1){
                $("#business_license_img").attr('src',res.path);
                $('input[name="business_license"]').val(res.path);
            }else if(type ==2){
                $("#tax_certificate_img").attr('src',res.path);
                $('input[name="tax_certificate"]').val(res.path);
            }else if(type ==3){
                $("#code_certificate_img").attr('src',res.path);
                $('input[name="code_certificate"]').val(res.path);
            }else if(type ==4){
                $("#multi_license_img").attr('src',res.path);
                $('input[name="multi_license"]').val(res.path);
            }
        }
        uploadFile(url,formFile,cb)
    }


    //法人营业执照
    $("#business_license_div").click(function () {
        $("#business_license_file").trigger("click");
    });

    $('#business_license_file').change(function(){
        uploadajax(this,1);
    })

    //公司税务登记证
    $("#tax_certificate_div").click(function () {
        $("#tax_certificate_file").trigger("click");
    });

    $('#tax_certificate_file').change(function(){
        uploadajax(this,2);
    })

    //组织机构代码证
    $("#code_certificate_div").click(function () {
        $("#code_certificate_file").trigger("click");
    });

    $('#code_certificate_file').change(function(){
        uploadajax(this,3);
    })

    //多证合一营业执照
    $("#multi_license_div").click(function () {
        $("#multi_license_file").trigger("click");
    });

    $('#multi_license_file').change(function(){
        uploadajax(this,4);
    })
    //重新填写
    $(".btn_error").click(function () {
        $(".step_one").show();
        $(".step_two").hide();
    });


    //开户银行autocomplete
    var ele=$('input[name="rz_kaihuyinhang"]' )
    ele.autocomplete({
      minLength: 0,
      source: banklist
    })
    ele.on("focus",function(){
        ele.autocomplete("search", "" );
    })
    ele.on("blur",function(){
        if(ele.val()&&banklist.indexOf(ele.val())==-1){
            layer.alert('所输开户银行未找到匹配项，请重新选择', {icon: 2})
            ele.val('')
            ele.css({"border-color":"red"})
        }
        else{
            ele.css({"border-color":""})
        }
    })

</script>